随着Web响应式的趋势越来越流行,媒体查询在创建响应式网站中起到了主要作用。利用媒体查询,我们可以针对不同的设备,如显示器、智能手机和平板,来写CSS。在这里我把常用的媒体查询进行了分类总结,希望在以后的工作当中方便查阅。这篇主要是对常用显示器和移动设备进行了总结。
显示器媒体查询
640px
1 | @media screen and (max-width: 640px) { |
800px
1 | @media screen and (max-width: 800px) { |
1024px
1 | @media screen and (max-width: 1024px) { |
HTC Evo,BlackBerry Torch,HTC Thunderbolt,HD2
1 | @media screen and (max-device-width: 480px) |
平板媒体查询
Motorola Xoom
1 | /* Landscape Mode */ |
HTC Flyer
1 | /* Landscape Mode */ |
BlackBerry PlayBook
1 | /* Landscape Mode */ |
HP TouchPad
1 | /* Landscape Mode */ |
Lenovo Thinkpad Tablet
1 | /* Landscape Mode */ |
Sony Tablet S
1 | /* Landscape Mode */ |
T-Mobile G-Slate
1 | /* Landscape Mode */ |
ViewSonic ViewPad 10
1 | /* Landscape Mode */ |
Dell Streak 7
1 | /* Landscape Mode */ |
ASUS Eee Pad Transformer
1 | /* Landscape Mode */ |
HTC One landscape & portrait
1 | @media screen |
HTC One portrait
1 | @media screen |
HTC One landscape
1 | @media screen |
Asus Nexus 7 landscape & portrait
1 | @media screen |
Asus Nexus 7 portrait
1 | @media screen |
Asus Nexus 7 landscape
1 | @media screen |
Kindle Fire HD 7” landscape & portrait
1 | @media only screen |
Kindle Fire HD 7” portrait
1 | @media only screen |
Kindle Fire HD 7” landscape
1 | @media only screen |
Kindle Fire HD 8.9” landscape & portrait
1 | @media only screen |
Kindle Fire HD 8.9” portrait
1 | @media only screen |
Kindle Fire HD 8.9” landscape
1 | @media only screen |
Non-Retina Screens
1 | @media screen |
Retina Screens
1 | @media screen |
Moto 360 Watch
1 | @media |